package cn.itcast.server.handler.xt;

import cn.itcast.message.xt.IoTLoginRequestMessage;
import cn.itcast.message.xt.IoTLoginResponseMessage;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@ChannelHandler.Sharable
public class IoTLoginReqHandler extends SimpleChannelInboundHandler<IoTLoginRequestMessage> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, IoTLoginRequestMessage msg) throws Exception {
        log.info("login msg: {}",msg);
        IoTLoginResponseMessage message = new IoTLoginResponseMessage(200, "success", null);
        ctx.writeAndFlush(message);
    }
}
